package com.yiqi.lottery.feature.lottery.model;

import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.suozhang.framework.entity.bo.UserInfoBo;
import com.yiqi.lottery.entity.bo.LotteryHistoryBo;
import com.yiqi.lottery.entity.bo.LuckyHistoryBo;
import com.yiqi.lottery.entity.bo.OrderBo;
import com.yiqi.lottery.entity.bo.RegisterBo;
import com.yiqi.lottery.feature.login.contract.LoginContract;
import com.yiqi.lottery.feature.login.dependencies.login.DaggerLoginModelComponent;
import com.yiqi.lottery.feature.lottery.contract.LottoContract;
import com.yiqi.lottery.feature.lottery.dependencies.lotto.DaggerLottoModelComponent;
import com.yiqi.lottery.framework.api.ApiLib;
import com.yiqi.lottery.framework.api.LotteryApi;
import com.yiqi.lottery.framework.api.UserApi;
import io.reactivex.Observable;

import javax.inject.Inject;
import java.util.List;

public class LottoModel implements LottoContract.Model {

    @Inject
    LotteryApi api;

    @Inject
    public LottoModel() {

        DaggerLottoModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }




    @Override
    public Observable<LuckyHistoryBo> getCurrentQi() {
        return api.getDaletouCurrentPeriod().compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> createOrder(OrderBo orderBo) {
        return api.createOrder(orderBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<List<LotteryHistoryBo>> getLotteryHistory(String label) {
        return api.getLotteryHistory(label).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }
}
